import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/home.vue'
import ItemMusic from '@/views/itemMusic.vue'
import Search from '@/views/search.vue'
Vue.use(VueRouter)
//定义routes路由的集合，数组类型
const routes = [
    //单个路由均为对象类型，path代表的是路径，component代表组件
    { path: '/', redirect: '/home'},
    { path: '/home', component: Home },
    { path: '/itemMusic', component: ItemMusic },
    { path: '/search', component: Search },
]

//实例化VueRouter并将routes添加进去
const router = new VueRouter({
    //ES6简写，等于routes：routes
    routes
});

//抛出这个这个实例对象方便外部读取以及访问
export default router